package puzzle.common.point;

public class Vct {
    public final int dx;
    public final int dy;

    public Vct(int dx, int dy) {
        this.dx = dx;
        this.dy = dy;
    }
    
    public Vct rrot() {
    	return new Vct(-dy, dx);
    }
    
    public Vct lrot() {
    	return new Vct(dy, -dx);
    }
    
    public Vct inv() {
    	return new Vct(-dx, -dy);
    }
    
    public int getManhattanDistance() {
    	return Math.abs(dx) + Math.abs(dy);
    }
    
    @Override
    public int hashCode() {
    	return dx + dy * 13;
    }
    
    @Override
    public boolean equals(Object other0) {
    	if (other0 instanceof Vct) {
    		Vct other = (Vct) other0;
    		return dx == other.dx && dy == other.dy;
    	} else {
    		return false;
    	}
    }

    @Override
    public String toString() {
    	return "[" + dx + "," + dy + "]";
    }
}
